﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Service.BusinessLayer.Entities;
using Service.DataAccess.DataAccessHelper;
using System.Data;
using System.Data.SqlClient;
namespace Service.DataAccess.DataAccessLogic
{
    public class NhanVien_DA
    {
        public void them(NhanVien nv)
        {
            Helper help = new Helper();
            SqlParameter[] par = new SqlParameter[7];
            par[0] = new SqlParameter("@manv", nv.Manv);
            par[1] = new SqlParameter("@honv", nv.Honv);
            par[2] = new SqlParameter("@tennv", nv.Tennv);
            par[3] = new SqlParameter("@gioitinh", nv.Gioitinh);
            par[4] = new SqlParameter("@diachi", nv.Diachi);
            par[5] = new SqlParameter("@sdt", nv.Sdt);
            par[6] = new SqlParameter("@chucvu", nv.Chucvu);
            help.InsertQuery("sp_nhanvien_them", par);
        }
        public void sua(NhanVien nv)
        {
            Helper help = new Helper();
            SqlParameter[] par = new SqlParameter[7];
            par[0] = new SqlParameter("@manv", nv.Manv);
            par[1] = new SqlParameter("@honv", nv.Honv);
            par[2] = new SqlParameter("@tennv", nv.Tennv);
            par[3] = new SqlParameter("@gioitinh", nv.Gioitinh);
            par[4] = new SqlParameter("@diachi", nv.Diachi);
            par[5] = new SqlParameter("@sdt", nv.Sdt);
            par[6] = new SqlParameter("@chucvu", nv.Chucvu);
            help.UpdateQuery("sp_nhanvien_sua", par);
        }
        public void xoa(string manv)
        {
            Helper help = new Helper();
            SqlParameter[] par = new SqlParameter[1];
            par[0] = new SqlParameter("@manv", manv);
            help.DeleteQuery("sp_nhanvien_xoa", par);
        }
        public DataSet LayDS_NhanVien()
        {
            Helper help = new Helper();
            DataSet ds_nv = help.SelectQuery("sp_nhanvien_layds");
            return ds_nv;
        }
    }
}
